#include "interface/IInterface.h"
#include <QBitmap>

void interface::IInterface::SetupBackground(QString path)
{
    QPixmap pixmap_bg(path);
    QPalette   palette_bg;
    palette_bg.setBrush(this->backgroundRole(),QBrush(pixmap_bg));
    this->setPalette(palette_bg);
    this->setMask(pixmap_bg.mask());
    this->setAutoFillBackground(true);
}

// setup the bnt, stick picture onto it
void interface::IInterface::SetupBtn(QPushButton * bnt, QString picPath)
{
    QPushButton * btnTemp = bnt;
    QPixmap pixmapTemp(picPath);
    QPalette   paletteTemp;
    paletteTemp.setBrush(btnTemp->backgroundRole(),QBrush(pixmapTemp));
    btnTemp->setPalette(paletteTemp);
    btnTemp->setIcon(pixmapTemp);
    btnTemp->setIconSize(pixmapTemp.size());
    btnTemp->setFixedSize(pixmapTemp.size());
    btnTemp->setMask(pixmapTemp.mask());
    btnTemp->setFocusPolicy(Qt::NoFocus);
}

// setup the label, stick picture onto it
void interface::IInterface::SetupLabel(QLabel * label, QString picPath)
{
    QLabel * labelTemp = label;
    QPixmap pixmapTemp(picPath);
    labelTemp->setPixmap(pixmapTemp);
}
